package lagern;

/**
 * Interface definition: Fach.
 * 
 * @author OpenORB Compiler
 */
public abstract class FachPOA extends org.omg.PortableServer.Servant
        implements FachOperations, org.omg.CORBA.portable.InvokeHandler
{
    public Fach _this()
    {
        return FachHelper.narrow(_this_object());
    }

    public Fach _this(org.omg.CORBA.ORB orb)
    {
        return FachHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:lagern/Fach:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("_get_anzahl")) {
                return _invoke__get_anzahl(_is, handler);
        } else if (opName.equals("_get_name")) {
                return _invoke__get_name(_is, handler);
        } else if (opName.equals("auslagern")) {
                return _invoke_auslagern(_is, handler);
        } else if (opName.equals("einlagern")) {
                return _invoke_einlagern(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_anzahl(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg = anzahl();
        _output = handler.createReply();
        _output.write_long(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__get_name(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg = name();
        _output = handler.createReply();
        _output.write_string(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_einlagern(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        int arg1_in = _is.read_long();

        try
        {
            einlagern(arg0_in, arg1_in);

            _output = handler.createReply();

        }
        catch (lagern.FachPackage.exInvalidCount _exception)
        {
            _output = handler.createExceptionReply();
            lagern.FachPackage.exInvalidCountHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_auslagern(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        int arg1_in = _is.read_long();

        try
        {
            auslagern(arg0_in, arg1_in);

            _output = handler.createReply();

        }
        catch (lagern.FachPackage.exInvalidCount _exception)
        {
            _output = handler.createExceptionReply();
            lagern.FachPackage.exInvalidCountHelper.write(_output,_exception);
        }
        catch (lagern.FachPackage.exNotEnoughPieces _exception)
        {
            _output = handler.createExceptionReply();
            lagern.FachPackage.exNotEnoughPiecesHelper.write(_output,_exception);
        }
        return _output;
    }

}
